// import './assets/main.css'
import {type Component, createApp} from 'vue'
import {createPinia} from 'pinia'
import ElementPlus from 'element-plus'
import "element-plus/dist/index.css"
import "element-plus/theme-chalk/dark/css-vars.css" // 引入暗黑主题
import "@/styles/dark-var.css" // css变量覆盖, 自定义暗黑主题颜色
import zhCn from "element-plus/es/locale/lang/zh-cn"
import dayjs from "dayjs"
import "dayjs/locale/zh-cn"
import updateLocale from "dayjs/plugin/updateLocale"
import calenderPlugin from "dayjs/plugin/calendar"
import "nprogress/nprogress.css" // 进度条
import 'virtual:uno.css'
// import * as ElementPlusIconsVue from '@element-plus/icons-vue' // 注册全部图标
import {Menu, DataAnalysis, Reading, List, User, Notification, Coin, SwitchButton,} from "@element-plus/icons-vue";
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import i18n from "@/i18n";

// 按需全局注册图标
const allGlobalComponent: Component = {Menu, DataAnalysis, Reading, List, User, Notification, Coin, SwitchButton}

import App from './App.vue'
import router from './router'

// 注册插件
dayjs.extend(updateLocale);
dayjs.extend(calenderPlugin);
//
dayjs.updateLocale("zh-cn", {
    // A : 上午/下午/晚上 , dddd: 星期
    calendar: {
        lastDay: "YYYY.MM.DD [昨天] A h:mm dddd",
        sameDay: "YYYY.MM.DD [今天] A h:mm dddd",
        nextDay: "YYYY.MM.DD [明天] A h:mm dddd",
        lastWeek: "YYYY.MM.DD A h:mm [上]dddd",
        nextWeek: "YYYY.MM.DD A h:mm [下]dddd",
        sameElse: "YYYY.MM.DD A h:mm dddd",
    },
});
// 使用 zh-cn
dayjs.locale('zh-cn');

const app = createApp(App)
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate) // pinia持久化插件

for (const [key, component] of Object.entries(allGlobalComponent)) {
    app.component(key, component)
}

app.use(pinia)
app.use(router)
app.use(ElementPlus, {
    locale: zhCn,
})
app.use(i18n)

app.mount('#app')
